<?php
//require_once 'debug2.php';
//if (isset($_POST) and !empty($_POST)){
//    ___save_debug($_POST, $desc='POST');
//}
//if (isset($_GET) and !empty($_GET)){
//    ___save_debug($_GET, $desc='GET');
//}
$phone_number=37282879541;
$method='updates';
$url=urlencode('http://www.smart-sim.ru/!podpiska.php');
//echo $url;
//https://service.smart-sim.ru:443/api/37282879541/updates?uname=paul&upass=kam9345t&http://agent.ksidea.ru/test_biling/!podpiska.php
//https://service.smart-sim.ru:443/api/37282879541/inc?uname=paul&upass=kam9345t&amount=5&cur=EUR&trid=4565465464654
function check($phone_number, $method, $url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://service.smart-sim.ru:443/api/".$phone_number."/".$method."?uname=paul&upass=kam9345t&url=".$url);
    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 3);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "");
//    curl_setopt($ch, CURLOPT_INTERFACE, "192.168.1.104");
    curl_setopt($ch, CURLOPT_INTERFACE, "88.196.96.108");
//    curl_setopt($ch, CURLOPT_INTERFACE, "217.16.20.63");
    

    $result = curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);

    echo '<pre>';
    print_r($info);    
    print_r($result);
    echo '</pre>';

    if ($info['http_code'] != 200) {
        echo "HTTP: " . $info['http_code'];
    }
    $xml = simplexml_load_string($result);
//var_dump($xml);
    //return $xml;
    //echo '<pre>';
    print_r($xml);
    //echo '</pre>';
}
check($phone_number, $method, $url); 
?>